package com.dat255.tentatime;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class ExamAdapter extends ArrayAdapter<Exam>{
	
	//Row layout
	private int resource;
	
	public ExamAdapter(Context context, int rowresource, List<Exam> objects) {
		super(context, rowresource,  objects);
		resource = rowresource;
		
		
	}
	
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		
	     	View v = convertView;
	        Exam exam = getItem(position);
	        
	   
	        	
	        	LayoutInflater vi = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	        	  v = vi.inflate(resource, null);
	    
	        TextView examID =(TextView) v.findViewById(R.id.textCourseID);
	        TextView examName =(TextView) v.findViewById(R.id.textCourseName);
	 
	        examID.setText(exam.getCourseID());
	        examName.setText(exam.getCourseName());
	 
	        return v;
	    }
	}
	